﻿using UnityEngine;
using System.Collections;

public class nukeManager : MonoBehaviour
{
	bool fadeBackIn;
	bool alreadyFading = false;
	public float Range = 10;
	public GameObject nukeprefab;
	public float countdown = 5;
	bool timing;
	// Use this for initialization
	void Start ()
	{
	
		
		timing = true;
		fadeBackIn = false;
	}
	
	void Update ()
	{
		
		if (timing) {
			countdown -= Time.deltaTime;
			if (countdown <= 0) {
				Vector3 pos = transform.position;
				pos.x = Random.Range (-Range, Range);
			//	pos.y= -3.5f;
				
				Instantiate (nukeprefab, pos, Quaternion.Euler (90, 180, 0));
		      
			}
		}
		
	
	
	}
	

}
